package com.mall.goods.common.enums;

import java.util.HashMap;

/**

 *
 * 商品促销类型
 * 
 *
 * Created 2017/4/13 10:13
 */
public class GoodsPromotionType {
    public static final int GENERAL = 0;
    public static final String GENERAL_TEXT = "";
    public static final int DISCOUNT = 1;
    public static final String DISCOUNT_TEXT = "限时折扣";
    public static final int PRESELL = 2;
    public static final String PRESELL_TEXT = "全款预售";
    public static final int BOOK = 3;
    public static final String BOOK_TEXT = "定金预售";
    public static final int GROUP = 4;
    public static final String GROUP_TEXT = "多人拼团";
    public static final int BUNDLING = 5;
    public static final String BUNDLING_TEXT = "优惠套装";
    public static final int SECKILL = 6;
    public static final String SECKILL_TEXT = "秒杀活动";
    public static final int BARGAIN = 7;
    public static final String BARGAIN_TEXT = "砍价活动";

    /**
     * 根据促销类型取得促销名称
     * @param type
     * @return
     */
    public static final String getText(int type) {
        switch(type) {
            case DISCOUNT:
                return DISCOUNT_TEXT;
            case PRESELL:
                return PRESELL_TEXT;
            case BOOK:
                return BOOK_TEXT;
            case GROUP:
                return GROUP_TEXT;
            case BUNDLING:
                return BUNDLING_TEXT;
            case SECKILL:
                return SECKILL_TEXT;
            case BARGAIN:
                return BARGAIN_TEXT;
            default:
                return GENERAL_TEXT;
        }
    }

    /**
     * 获取所有属性值
     * @return
     */
    public static final HashMap<Integer,String> getAllValuesMap() {
        HashMap<Integer, String> fields = new HashMap<>();
        fields.put(GENERAL, GENERAL_TEXT);
        fields.put(DISCOUNT, DISCOUNT_TEXT);
        fields.put(PRESELL, PRESELL_TEXT);
        fields.put(BOOK, BOOK_TEXT);
        fields.put(GROUP, GROUP_TEXT);
        fields.put(BUNDLING,BUNDLING_TEXT);
        return fields;
    }

}
